1. Field of the Invention
The present invention relates to a data communication method, a communication frame generating method, and a medium on which a program for executing the methods are recorded, and more particularly to a data communication method which prevents delay in data transmission in half duplex communication in a communication device having a utilization portion for executing application processings and a control portion for executing communication protocol processings, a communication frame generating method which prevents deterioration of data transmission (transfer) efficiency in asynchronous communications by radio and wire, and a medium on which program for carrying out the data communication method and the communication frame generating method are recorded.
2. Description of the Background Art
In a communication device having a utilization portion for executing application processings and a control portion for executing communication protocol processings, the utilization portion and the control portion exchange data in data transmission/reception. In data transmission, the utilization portion sends a data transmission request to the control portion. The control portion receives the data transmission request and then performs the processing of transmitting the data. In data reception, the control portion receives data and transfers the received data to the utilization portion. The utilization portion receives and processes the transferred data from the control portion.
Known data communication systems that perform between the communication devices generally include the full duplex communication system and half duplex communication system.
In the full duplex communication system, lines for transmission and reception are individually provided between communication devices, so that each communication device can freely transmit data without being affected by other communication devices. On the other hand, in the half duplex communication system, only a single line is provided between communication devices, so that a communication device cannot transmit data while the other communication device is transmitting data (therefore it receives the data).
Hence, in the half duplex communication system, a xe2x80x9ctransmission rightxe2x80x9d indicating which of the communication devices is the subject of the data transmission is generally transmitted/received together with the data. The half duplex communication system thus defines that only a communication device having the transmission right can perform data transmission.
Next, FIG. 8 shows an example of conventional data communication by half duplex performed between communication devices having utilization portions and control portions as described above. FIG. 8 is a diagram showing an example of a conventional communication sequence performed between communication devices A and B using the conventional data communication method. In FIG. 8, the utilization portion in the communication device A is represented as xe2x80x9cutilization portion Axe2x80x9d and its control portion as xe2x80x9ccontrol portion A,xe2x80x9d and the utilization portion in the communication device B is represented as xe2x80x9cutilization portion Bxe2x80x9d and its control portion as xe2x80x9ccontrol portion B.xe2x80x9d
In the initial state, suppose that the transmission right resides in the communication device A and that a request for transmitting data B is occurring in the communication device B. First, the control portion A transmits only the transmission right to the control portion B, for it does not have a data transmission request at this time. The control portion B receives the transmission right sent from the control portion A, obtains the transmission-requested data B from the utilization portion B, and then transmits the data together with the transmission right to the control portion A. The control portion A then receives the data B and transmission right sent from the control portion B. Suppose that a request for transmitting data A is now occurring in the communication device A. In this case, the control portion A transfers the data B to the utilization portion A to preferentially process the data B transmitted from the control portion B. When receiving the data B, the utilization portion A processes the data B and then transfers the transmission-requested data A to the control portion A. Then, at last, the control portion A transmits the data A to the control portion B together with the transmission right.
In this conventional communication device, as stated above, application processing to received data (the data B) has priority over its own data transmission request processing (the data A). Accordingly its data transmission is delayed by the time the utilization portion (the utilization portion A) takes to process the received data (shown by the thick arrow in FIG. 8). In the case of systems for communications of audio data, moving picture data, etc. which seriously require the real-time property, such data transmission delay causes serious problems such as discontinuity of sound, blanks of image, etc.
Conventionally, there have been two kinds of systems for connecting a plurality of communication devices: synchronous communication system and asynchronous communication system. In these communication systems, communication devices generally transmit/receive information etc. by using communication frames. In the asynchronous communication system, communication timing of communication frames transmitted/received between communication devices is not synchronized. Therefore the communication devices use communication frames including start and end flags at the beginning and end so that they can recognize the beginning and end of each communication frame.
FIG. 9 shows an example of structure of a communication frame used in the asynchronous communication. Referring to FIG. 9, the communication frame used in the asynchronous communication includes address for identification of the destination communication device, data representing the transmitted information, etc., as well as the above-described start and end flags.
When receiving the start flag, the communication device checks the following address and then processes the information to the end flag. The communication device thus recognizes the beginning and the end of the communication frame in accordance with the start and end flags. If any address code or data code identical to the start or end flag exists, the communication device may erroneously recognize the beginning or end of the communication frame. To avoid this problem, the communication device applies transparency control to codes representing the same codes as the start and end flags.
In short, this transparency control means conversion of one value to another value. For example, if a code A identical to the start flag code is included in data, the code A is replaced by another code B (needless to say, the code B differs from the end flag code). The code after converted is generally provided with an extra identifier code so that the recipient can correctly recognize the data transparency-controlled on the sender. That is to say, the transparency-controlled code B is preceded by an identifier code to allow the recipient to determine whether the code B after transparency control is a transparency-controlled code B or the code B not transparency-controlled.
The following is a specific example of the transparency control method, in which address, data, etc. which are identical to the start flag code xe2x80x9cC0hxe2x80x9d and the end flag code xe2x80x9cC1hxe2x80x9d are converted. The letter xe2x80x9chxe2x80x9d represents hexadecimal.
C0hxe2x86x927Dh E0h
C1hxe2x86x927Dh E1h
7Dhxe2x86x927Dh 5Dh
In the example above, the one-byte code xe2x80x9cC0hxe2x80x9d is converted into the two-byte code xe2x80x9c7Dh E0h,xe2x80x9d and the one-byte code xe2x80x9cC1hxe2x80x9d is converted into the two-byte code xe2x80x9c7Dh E1h.xe2x80x9d The part xe2x80x9c7Dhxe2x80x9d corresponds to the identifier code. Note that the code xe2x80x9c7Dhxe2x80x9d used as the identifier code is converted into the two-byte code xe2x80x9c7Dh 5Dh.xe2x80x9d If the code xe2x80x9c7Dhxe2x80x9d is left unchanged, then data not subjected to transparency control (e.g., xe2x80x9cE0hxe2x80x9d) will be erroneously restored on the recipient in the presence of a normal data code xe2x80x9c7Dh.xe2x80x9d
Thus the recipient can obtain the original codes by applying reverse transparency control only to codes preceded by the code xe2x80x9c7Dh.xe2x80x9d The codes xe2x80x9cE0h,xe2x80x9d xe2x80x9cE1h,xe2x80x9d and xe2x80x9c5Dhxe2x80x9d not preceded by the code xe2x80x9c7Dhxe2x80x9d are thus not converted but left unchanged on the recipient.
However, in the above-described transparency control method, a one-byte code is converted to a two-byte code. Then the communication frame becomes longer as a larger number of codes are subjected to the transparency control, and then the communication will take longer time than required.
Therefore an object of the present invention is to provide a data communication method which eliminates delay in data transmission due to data processing time in an utilization portion to improve the data transmission efficiency and a medium on which a program for executing that method is recorded.
Another object of the present invention is to provide a communication frame generating method which suppresses expansion of length of communication frames after transparency control by previously avoiding application of the transparency control to codes which can arbitrarily be set, such as identification address, to prevent deterioration of the data transmission (transfer) efficiency and a medium on which a program for executing that method is recorded.
To achieve the objects above, the present invention has the following features.
A first aspect is directed to a data communication method for use in a communication device performing data communication by half duplex communication system and having utilization means for executing application processing and control means for executing communication protocol processing, the data communication method being performed by the control means. The method in accordance with the first aspect of the present invention comprises the steps of receiving data transmitted from another communication device, determining whether a data transmission request is issued from the utilization means, preferentially performing transmission of data based on the data transmission request when receiving data in the step of receiving and determining that the data transmission request is issued in the step of determining, and transferring the data received in the step of receiving to the utilization means after finishing the transmission in the step of preferentially performing.
As stated above, according to the first aspect, the control means determines whether a data transmission request is occurring in its own communication device at the time when it receives data from another communication device. When a data transmission request is occurring, the control means transmits the transmission-requested data to another communication device before transferring the received data to the utilization means. This eliminates communication delay corresponding to the time the utilization means takes to process the received data, thus improving the data transfer efficiency.
Preferably, according to a second aspect, further to the first aspect, the data used in the communication may be data of which the utilization means expects a real-time property, such as audio data or moving picture data. The effect of the first aspect can most effectively be demonstrated to data like audio data and moving picture data which seriously require the real-time property.
A third aspect is directed to a communication frame generating method for generating a communication frame used in communication in a communication device in an asynchronous communication system. The method in accordance with the third aspect of the present invention comprises the steps of generating a start flag indicating the beginning of the communication frame and an end flag indicating the end of the communication frame, obtaining or generating particular information stored between the start flag and the end flag in such a way that information which the communication device can arbitrarily set in the particular information does not contain any code identical to the flag codes of the start and end flags, and forming the communication frame on the basis of the start flag, the end flag, and the particular information.
As stated above, according to the third aspect, information which can arbitrarily be set by the communication device in particular information in the communication frame is generated to exclude the same codes as flag codes of the start and end flags. In transparency control performed after the generation of the communication frame, this reduces the number of transparency-processed codes. This suppresses expansion of the length of the communication frame after the transparency control, thus preventing deterioration of the data transmission (transfer) efficiency.
Preferably, according to a fourth aspect, the step of obtaining or generating the particular information in the third aspect may comprise generating an arbitrary code of a predetermined number of bits by using random numbers, and when the arbitrary code contains any code identical to the flag codes, repeatedly generating an arbitrary code by using random numbers, and determining the arbitrary code which does not contain any code identical to the flag codes as information to be generated.
Also preferably, according to a fifth aspect, the step of obtaining or generating the particular information in the third aspect may comprise generating an arbitrary code of a predetermined number of bits by using random numbers, and when the arbitrary code contains any code identical to the flag codes, converting the identical code to another predetermined code different from the flag codes, and determining the arbitrary code which does not contain any code identical to the flag codes as information to be generated.
More preferably, according to sixth to eighth aspects, the information which the communication device can arbitrarily set in the particular information in the third to fifth aspects may be address information used for identification of the communication device.
A ninth aspect is directed to a recording medium containing a data communication program for use in a communication device performing data communication by half duplex communication system and having utilization means for executing application processing and control means for executing communication protocol processing, the data communication program being executed in the control means, and the data communication program being computer-readable and for realizing on the communication device an operational environment. The operational environment in accordance with the ninth aspect of the present invention comprises the steps of receiving data transmitted from another communication device, determining whether a data transmission request is issued from the utilization means, when receiving data in the step of receiving and determining that the data transmission request is issued in the step of determining, preferentially performing transmission of data based on the data transmission request and after finishing the transmission in the step of preferentially performing, transferring the data received in the step of receiving to the utilization means.
Preferably, according to a tenth aspect, further to the ninth aspect, the data used in the communication may be data of which the utilization means expects a real-time property, such as audio data or moving picture data.
An eleventh aspect is directed to a recording medium on which a program executed in a communication device in an asynchronous communication system and for generating a communication frame used in communication is recorded, the program being computer-readable and for realizing on the communication device an operational environment. The operational environment in accordance with the eleventh aspect of the present invention comprises the steps of generating a start flag indicating the beginning of the communication frame and an end flag indicating the end of the communication frame, obtaining or generating particular information stored between the start flag and the end flag in such a way that information which the communication device can arbitrarily set in the particular information does not contain any code identical to the flag codes of the start and end flags and forming the communication frame on the basis of the start flag, the end flag, and the particular information.
Preferably, according to a twelfth aspect, further to the eleventh aspect, the step of obtaining or generating the particular information may comprise generating an arbitrary code of a predetermined number of bits by using random numbers, and when the arbitrary code contains any code identical to the flag codes, repeatedly generating an arbitrary code by using random numbers and determining the arbitrary code which does not contain any code identical to the flag codes as information to be generated.
Also preferably, according to a thirteenth aspect, further to the eleventh aspect, the step of obtaining or generating the particular information may comprise generating an arbitrary code of a predetermined number of bits by using random numbers, and when the arbitrary code contains any code identical to the flag codes, converting the identical code to another predetermined code different from the flag codes and determining the arbitrary code which does not contain any code identical to the flag codes as information to be generated.
More preferably, according to fourteenth to sixteenth aspects, further to the eleventh to thirteenth aspects, the information which the communication device can arbitrarily set in the particular information may be address information used for identification of the communication device.
As stated above, the ninth to sixteenth aspects are directed to recording medium on which program for executing the data communication method and the communication frame generating method of the first to eighth aspects are recorded. This allows supply of the data communication method and the communication frame generating method of the first to eighth aspects in the form of software to an arbitrary communication device.